/**
 * 技能的工厂函数
 */

import { MethodNotFindError } from "../class/errors";
import { Method, MethodSubClass } from "../class/Method";
import { Cure } from "../methods/治愈";
import { Eat } from "../methods/吃";
import { FengHuangHuoXian } from "../methods/凤凰火线";
import { Harvest } from "../methods/收割";
import { Infuriate } from "../methods/激怒";
import { LanYingBaWangQiang } from "../methods/蓝银霸王枪";
import { BaDuanShuai } from "../methods/八段摔";
import { SaoWei } from "../methods/扫尾";
import { ShouHuZhiLi } from "../methods/守护之力";
import { LeiTingZhiJie } from "../methods/雷霆之劫";
import { HuaYuGuiChen } from "../methods/化羽归尘";
import { CeHuaTeQuan } from "../methods/策划特权";
import { ShiShenKuangZhan } from "../methods/弑神狂斩";
import { ShiSong } from "../methods/狮颂";
import { MoYanLongYin } from "../methods/魔炎龙吟";

/**
 * 技能工厂
 */
export class MethodFactory {
    static methods: typeof MethodSubClass[] = [LanYingBaWangQiang, FengHuangHuoXian, Eat, Cure, Harvest, Infuriate, BaDuanShuai, SaoWei, ShouHuZhiLi, LeiTingZhiJie, HuaYuGuiChen, CeHuaTeQuan, ShiShenKuangZhan,ShiSong,MoYanLongYin]
    static getByName(name: string) {
        const method = this.methods.find(e => e.methodName === name);
        if (method === undefined) {
            throw new MethodNotFindError()
        }
        return method;
    }
    /** 获取所有技能名称 */
    static getAllMethodsNames() {
        return this.methods.map(MethodClass => MethodClass.methodName);
    }
}